import MessageHandler from "./MessageHandler";


export class JsonMessageHandler implements MessageHandler {

    encode(msg: net.SendMessage): void {
        let data: net.ReqData = { session: msg.session, protoId: msg.sendData.protoId, data: msg.sendData.data }
        msg.data = JSON.stringify(data);
    }

    decode(bytes: any): net.ResData {
        let data: net.ResData = JSON.parse(bytes)
        return data;
    }

    getID(protoID: any) {

    }
    init(): void {
    }

}